package cate.game.play.skill.passive.hero;

import cate.common.util.XT;
import cate.game.play.buff.Buff;
import cate.game.play.buff.h.回合伤害结算BH;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.proce.action.ctx.ActionCtx;
import cate.game.play.skill.passive.PassiveHandler;

import java.util.List;

/**
 * 提升我方所有单位造成【灼烧】和【焚烧】的伤害，提升数值为莫邪攻击力的15%
 */
public class 花舞影错PH extends PassiveHandler {

	private List<String> 标签;

	private double 系数;

	//标签=灼烧#焚烧&系数=1500
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		标签 = args.getStrList("标签");
		系数 = args.getWDouble("系数",0d);
	}

	@Override
	public void parseExt(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		系数 += args.getWDouble("系数", 0d);
	}

	@Override
	public void onOtherAddBuff(ActionCtx action, Buff otherBuff) {
		if (skill.owner.isDead()) {
			return;
		}
		if (otherBuff.caster.getTeam() != skill.owner.getTeam()) {
			return;
		}
		if (XT.isNotBlank(标签) && !otherBuff.cfg.containTags(标签)) {
			return;
		}
		if (otherBuff.handler instanceof 回合伤害结算BH) {
			((回合伤害结算BH) otherBuff.handler).addExDamage(skill.owner.attr.attTotal() * 系数);
		}
	}
}
